Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove collector container and merge it with planner #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

machacekondra
Copy link
Collaborator

Since collector is simple golang app, we don't need to run it as standalone container. This PR changes the collector to be run from planner-agent.

@machacekondra machacekondra force-pushed the remove_collector branch 2 times, most recently from def0a6c to 90b9e38 Compare October 16, 2024 13:49
Since collector is simple golang app, we don't need to run it
as standalone container. This PR changes the collector to be
run from planner-agent.

Signed-off-by: Ondra Machacek <[email protected]>
@@ -46,7 +46,7 @@ storage:
contents:
inline: |
PasswordAuthentication yes
- path: /home/core/vol/config.yaml
- path: /home/core/.migration-planner/config.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't be .migration-planner/config/config.yaml?

Copy link
Collaborator Author

@machacekondra machacekondra Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, but won't help us actually, as we need to pass the path as parameter anyway, if we don't use default /etc/planner/config as config-dir . But will change as it makes more sense.

@@ -92,6 +92,9 @@ func (a *Agent) Run(ctx context.Context) error {
}
healthChecker.Start(healthCheckCh)

collector := NewCollector(a.log, a.config.DataDir)
go collector.collect()
Copy link
Collaborator

@tupyy tupyy Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the context needs to be passed into the collector to be stopped gracefully.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think? Currently we keep running the agent, which monitor the changes of inventory.json. Maybe we should keep it running just with noop, because noone can update the inventory.json, but if we keep it running podman-auto-update can update image and restart the pod, so we actually do update the invetory.json.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was speaking about stopping the goroutine. If you don't check the context it will leak at the end. Also, we must wait for the collector to close the inventory.json properly before exiting the agent.

logger.Println("Wait for credentials")
waitForFile(credsFile)
c.log.Infof("Wait for credentials")
waitForFile(credentialsFilePath)
Copy link
Collaborator

@tupyy tupyy Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, now that we've integrated the collector into the agent, I think it's better to pass the credentials as struct to the collector and start it only when we get the credentials.
wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we keep the credentials.json file we can restart the service (for example, if there is new image) and fetch new inventory. If we just send over credentials struct, we will loose it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants